import { createRouter, createWebHistory } from 'vue-router'
import Home from "@/views/home/index.vue"

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "home",
      component: Home,
      redirect: "/index",
      children: [
        {
          path: "/index",
          component: () => import("@/views/article/index.vue"),
        },
        {
          path: "/article/:id",
          component: () => import("@/views/detail/index.vue"),
        },
        {
          path: "/like",
          component: () => import("@/views/like/index.vue"),
        },
        {
          path: "/collect",
          component: () => import("@/views/collect/index.vue"),
        },
        {
          path: "/my",
          component: () => import("@/views/my/index.vue"),
        },
      ],
    },
    {
      path: "/login",
      name: "login",
      component: () => import("@/views/login/index.vue"),
    },
    {
      path: "/register",
      name: "register",
      component: () => import("@/views/register/index.vue"),
    },
  ]
})

export default router
